﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BO;
using BL;

namespace AnimalFarm.AuctionMarket_manage
{
    public partial class AddNewFieldType : Form
    {
        public AddNewFieldType()
        {
            InitializeComponent();
        }

        private void btnCreate_Click(object sender, EventArgs e)
        {
            string fieldType = txtFieldTypeName.Text;
            
            FieldType_Info fInfo = new FieldType_Info();
            
            fInfo.FieldTypeName = fieldType;

            B_FieldType bF = B_FieldType.CreateInstance();
            if (fieldType != null)
            {
                bool isEffected = bF.CreateOneFieldType(fInfo);
                if (isEffected == true)
                {
                    MessageBox.Show("Create a new field type successfully!", "Creating successuflly", MessageBoxButtons.OK);
                    txtFieldTypeName.Text = "";
                    txtFieldTypeName.Focus();
                }
                else
                {
                    MessageBox.Show("Cannot create a new field type successfully!", "Missing Data", MessageBoxButtons.OK);
                    txtFieldTypeName.Focus();
                }
            }
        }
    }
}
